﻿<UserControl x:Class="TrackMe.View.Frames.TaskSearch"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             mc:Ignorable="d" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:vm="clr-namespace:TrackMe.Apps.VM;assembly=TrackMe.Apps" 
             xmlns:beh="clr-namespace:TrackMe.View.Behaviours" 
             d:DataContext="{d:DesignInstance vm:TaskSearchVM}"
             d:DesignHeight="300" 
             d:DesignWidth="300">

    <UserControl.Resources>
        <CollectionViewSource x:Key="found">
            <CollectionViewSource.Source>
                <PriorityBinding>
                    <Binding Path="Found" IsAsync="True"/>
                    <Binding Path="WaitMessage"/>
                </PriorityBinding>
            </CollectionViewSource.Source>
        </CollectionViewSource>

        <!-- ItemContainerStyle with the Trigger for Selected -->

    </UserControl.Resources>

    <DockPanel>
        <DockPanel DockPanel.Dock="Top">
            <Button Name="bRefresh" DockPanel.Dock="Right" Content="(R)" Command="{Binding RefreshTfsCmd}"/>
            <TextBox 
                Text="{Binding Path=SearchFor, UpdateSourceTrigger=PropertyChanged}"
                beh:TextBoxBehaviourLikeAutoComplete.Active="True"
                beh:TextBoxBehaviourLikeAutoComplete.SelectCmd="{Binding Path=(beh:ListBoxBehaviourLikeAutoComplete.SelectCmd),ElementName=listBox,Mode=OneWay}"
                />
        </DockPanel>
        <ListBox x:Name="listBox"
            ItemContainerStyle="{StaticResource SelectedTask}"
            beh:ListBoxBehaviourLikeAutoComplete.Active="True"
            Style="{StaticResource TaskListBox}"
            Focusable="False"
            ItemsSource="{Binding Source={StaticResource found}}" Background="{DynamicResource ListBackground}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" BorderThickness="0">
        </ListBox>
    </DockPanel>
</UserControl>
